﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace _395_2d
{
    class NPC : Ship
    {
        public NPC(SpriteManager sm, string t, string w, int h, Vector2 p, Vector2 s)
        {
            Texture = t;
            Weapon = w;
            Health = h;

            bounds = new BoundingBox(p, s);
            SM = sm;
        }

        public void Update(GameTime gt)
        {
            Vector2 velocity = new Vector2(0, 60);
            bounds.topLeft += velocity * (float)gt.ElapsedGameTime.TotalSeconds;
        }

        public override void shoot(GameTime gt)
        {
            Weapon w = (Weapon)Content.Weapons[Weapon];

            if (w.RateOfFire > 0 && gt.TotalGameTime.TotalSeconds - LastShot > w.RateOfFire)
            {
                SM.AddEnemyProjectile(new Bullet(new Vector2(bounds.topLeft.X + bounds.size.X/2 - 10,bounds.topLeft.Y + bounds.size.Y), new Vector2(0, 500), w.ProjectileDamage, w.ProjectileTexture));
                LastShot = gt.TotalGameTime.TotalSeconds;
            }
        }
    }
}
